Skip to content

Conversation

@archandatta
Copy link
Contributor

@archandatta archandatta commented Jan 6, 2026

Note

Introduces a streamlined way to prepare the Cloudflare web-bot-auth browser extension for Kernel.

  • New extensions build-web-bot-auth command with flags --to, --url, --key (JWK or PEM), and --upload to optionally upload under a given name
  • Automates download of a pinned web-bot-auth commit, Node/npm install, build, bundle, and extraction of artifacts
  • Injects Kernel-specific URLs into templates (policy.json, plist, update.xml) using a readable ExtensionName path
  • Handles signing keys: validates PEM, converts JWK→PEM, writes private_key.pem, and adds .gitignore to exclude it from uploads
  • Copies built artifacts (.crx, update.xml, MV3 chromium files, policy/) to output directory and prints next steps
  • Adds utility helpers for crypto (PEM validate, JWK→PEM) and file ops (copy dir/file, modify files) with tests; adds download/extract tests for the extension

Written by Cursor Bugbot for commit a34ef52. This will update automatically on new commits. Configure here.

@archandatta archandatta marked this pull request as ready for review January 7, 2026 16:08
@archandatta archandatta requested a review from rgarcia January 7, 2026 17:46
@archandatta archandatta force-pushed the archand/add-support/web-bot-auth branch from 01fb400 to 6380ccd Compare January 9, 2026 18:20
Copy link
Contributor

@rgarcia rgarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feature addition! The overall structure is clean and the UX is thoughtful with helpful next-steps messaging.

Main areas to address:

  • JWK vs PEM messaging: Several places in help text, logs, and comments refer to "JWK" but PEM format is also supported. Would be good to make this consistent.
  • Error handling: A few places where os.Stat errors other than IsNotExist are silently ignored, and some URL update failures are warnings instead of errors.
  • Stability: Consider pinning the GitHub download to a specific commit to avoid upstream breaking changes.
  • Crypto code: The stdlib already has crypto/x509.MarshalPKCS8PrivateKey for Ed25519 - no need to hand-roll ASN.1.

// Error if no replacements were made
if modified == original {
return fmt.Errorf("pattern %q not found in file %s", oldStr, path)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ModifyFile fails with misleading error when replacement equals search

Medium Severity

The ModifyFile function returns a "pattern not found" error when modified == original, but this condition is also true when the search pattern exists but the replacement string is identical to it. If a user passes --url http://localhost:8000 (matching defaultLocalhostURL), all ModifyFile calls in buildWebBotAuthExtension will fail with a misleading error message, even though the pattern was found. The comparison doesn't distinguish between "pattern absent" and "replacement is no-op".

Additional Locations (1)

Fix in Cursor Fix in Web

@archandatta archandatta requested a review from rgarcia January 12, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants